-- by Paul Sebastien, pauls@sirius.com, http://www.bitstream.net/psykosonik
-- The 'Pro' version of this behavior will feature such additions as automatic instantiation of multiple unique Beatnik instances, control over fade in and fade out upon starting and stopping the Groovoid, access to several additional Groovoids in the 'Pro' soundbank, and more. For more info, go to http://www.headspace.com/
global groovoidPlayer
property pWhichGroovoid
property pWhichEvent
property pLoopState
on getPropertyDescriptionList
-- initialize the Beatnik Xtra instance for playing Groovoids
-- NOTE: you may want to instantiate multiple instances like the one below, using different instance names each time, in order to play back multiple Groovoid files simultaneously, if that's what you need to do. You can copy and paste this initializing script below and just change 'groovoidPlayer' to 'groovoidPlayer2' and 'groovoidPlayer3' and so on, for each instance, and then set the mouse event scripts or 'doIt' script to target these additional instances accordingly, depending on how many files you need to play at once.
put "------------------------------"
if ilk(groovoidPlayer) = #instance then stop(groovoidPlayer)
set groovoidPlayer = VOID
set groovoidPlayer = new(xtra "beatnik",TRUE)
set bankFileName = the moviePath & "patches.hsb"
put "groovoidPlayer =" && groovoidPlayer
put "Bank =" && bankFileName
put "SetSampleLibrary(groovoidPlayer) = " & setsampleLibrary(groovoidPlayer, bankFileName)
put "SetReady(groovoidPlayer) = " & setReady(groovoidPlayer)
put "isReady(groovoidPlayer) = " & isReady(groovoidPlayer)
if not(isReady(groovoidPlayer)) then
alert "The Beatnik Xtra did not initialize, the Beatnik soundbank file 'patches.hsb' must be in the same folder as your current Director movie is in (or modify the path in the script). Also, make sure that the Xtra (BEATNIK.X32) is added to this movie."
exit
end if
-- finished initializing the Beatnik Xtra instance for playing Groovoids
if the pWhichEvent of me = #mouseDown then doIt me
end
on mouseUp me
if the pWhichEvent of me = #mouseUp then doIt me
end
on mouseEnter me
if the pWhichEvent of me = #mouseEnter then doIt me
end
on mouseLeave me
if the pWhichEvent of me = #mouseLeave then doIt me
end
on mouseWithin me
if the pWhichEvent of me = #mouseWithin then doIt me
end
on enterFrame me
if the pWhichEvent of me = #enterFrame then doIt me
end
on exitFrame me
if the pWhichEvent of me = #exitFrame then doIt me
end
on stopMovie
global groovoidPlayer
stop(groovoidPlayer)
closeBeatnik(groovoidPlayer)
set groovoidPlayer=VOID
end stopMovie
on getBehaviorDescription
set description = "PLAY GROOVOID LITE BEHAVIOR" && RETURN & "by Paul Sebastien pauls@sirius.com" && RETURN && RETURN & "This Beatnik Behavior allows you to trigger the playback of Groovoids, RMF music and sound FX files that are conveniently built into the soundbank (patches.hsb) that accompanies the Beatnik Xtra Lite." && RETURN && RETURN & "PARAMETERS:" && RETURN & "ò Choose a Groovoid to play:" && RETURN & "...Lets you choose which Groovoid to play." && RETURN && RETURN & "ò Choose a trigger event:" && RETURN & "...Lets you choose which Director event you want to start the playback of the Groovoid." && RETURN && RETURN & "ò Looping:" && RETURN & "...Whether the Groovoid should play over and over again or not."&& RETURN && RETURN & "IMPORTANT:" && RETURN &&RETURN & "- This behavior requires that the Beatnik Xtra Lite is properly added to your Director project, and also, the Beatnik soundbank (patches.hsb) must be in the same directory as your Director project file, otherwise you should change the path to the soundbank in this behavior's script if the soundbank resides elsewhere." && RETURN && RETURN & "- If you want to use this behavior to play multiple Groovoids simultaneously, you should modify the Beatnik instance name used in this behavior's script so it is different/unique for each instance. Currently, the instance name used is 'groovoidPlayer', so if using multiple Groovoids that need to play at the same time, you can modify the name in the script to 'groovoidPlayer2' and so on, as needed, to create multiple separate Groovoid players." && RETURN &&RETURN & "For more information on instantiating the Beatnik Xtra Lite, refer to the documentation or other Beatnik Xtra sample movies." && RETURN && RETURN & "To upgrade to Beatnik Behaviors Pro, or for more information on Beatnik-related products and music files, visit the Headspace web site at:" && RETURN && RETURN & "http://www.headspace.com"